function doSearch() {
	$('#tt').datagrid('load', {
		brushId: $('#brushId').val(),
		startDay: $('#startDay').datebox('getValue'),
		endDay: $('#endDay').datebox('getValue'),
		isExec: $('#isExec').combobox('getValue'),
		brushName : $('#brushName').val()
	});
	$('#tt').datagrid('unselectAll');
}
$(function() {
	$('#isExec').combobox("select",-1);
});
function add() {
	showMyWindow('新增', '/brushConfigTimer/addConfig', 800, 600);
}

function edit() {
	var row = $('#tt').datagrid('getSelected');
	if (row) {
		showMyWindow('编辑', '/brushConfigTimer/' + row.id + '/configUpdate', 800, 600);
	} else {
		showMsg(market.content.title, market.content.tips, alert);
	}
}

function copy() {
	var row = $('#tt').datagrid('getSelections');
	if (row.length == 0) {
		showMsg(market.content.title, "请选择一条记录！", alert);
		return false;
	}
	if (row.length > 1) {
		showMsg(market.content.title, "复制操作只能选择一条记录！", alert);
		return false;
	}
	showMyWindow('拉活定时器 | 复制', '/brushConfigTimer/' + row[0].id + '/configCopy', 800, 600);
}

function del() {
	var row = $('#tt').datagrid('getSelected');
	$.messager.confirm('温馨提醒', '你确定删除本条数据吗？', function(r) {
		if (r) {
			$.get('/brushConfigTimer/deleteConfig?id=' + row.id, function(data) {
				if (data.return_code == '1') {
					top.showMsg(market.content.title, data.return_msg, alert);
					doSearch();
				} else if (data.return_code == '3') {
					top.showMsg(market.content.title, data.return_msg, alert);
				} else {
					$.messager.alert(market.content.title, data.return_msg);
				}
			});
		}
	});
}

function formatterApk(value, row, index) {
	var a = '<a href="#" onclick="editApk(' + "'" + row.id + "'" + ')">配置</a> ';
	return a;
}

function editApk(id) {
	showMyWindow('配置', '/brushConfig/' + id + '/apkList', 900, 500);
}


function formatterType(value) {
	if (value == 0) {
		return "未执行";
	}
	if (value == 1) {
		return "已执行";
	}

}
